package com.darkplanet.management.service;

import com.darkplanet.management.dao.IProjectDao;
import com.darkplanet.management.dao.IProjectDaoImpl;
import com.darkplanet.management.domain.Project;

import java.util.List;

public class ProjectService implements IProjectService {
    IProjectDao iProjectDaoImpl = new IProjectDaoImpl();

    @Override
    public Project getOneProject(Integer id) {
        Project project = iProjectDaoImpl.getProjectById(id);
        return project;
    }

    @Override
    public List<Project> getAllProject() {
        List<Project> allProject = iProjectDaoImpl.getAllProject();
        return allProject;
    }

    @Override
    public boolean addProject(String project_name, String client_company, String customer_principal, String project_manager, Integer developers_num, String start_time, String project_time, Double estimated_cost, String level, String finish_time, String remark) {
        iProjectDaoImpl.add(project_name,client_company,customer_principal,project_manager,developers_num,start_time,project_time,estimated_cost,level,finish_time,remark);
        return true;
    }

    @Override
    public boolean deleteProject(Integer project_id) {
        iProjectDaoImpl.delete(project_id);
        return true;
    }

    @Override
    public boolean updateProject(Integer project_id, String project_name, String client_company, String customer_principal, String project_manager, Integer developers_num, String start_time,String project_time,Double estimated_cost,String level,String finish_time,String remark) {
        iProjectDaoImpl.update(project_id,project_name,client_company,customer_principal,project_manager,developers_num,start_time,project_time,estimated_cost,level,finish_time,remark);
        return true;
    }
}
